I was / am having the same problem. I tried removing the power chord (since I am using a generic one). I also read somewhere (pinterest, i am not kidding) that repairing file permissions did the trick so I also tried that. Not sure if what I did helped or not, now i am back on the generic charger and the erratic behaviour seems to be gone. So maybe fixing permissions and/or not using a generic power charger could help.