i would backup everyone on both of you sd cards to a computer.
(also back up any apps with titanium and text and such)
read this whole page
then flash stock gingerbread
factory reset your phone
then flash the kernal in the same thread
(format your external sd in your pc, then put it back in your phone and format it with your phone)
remember to back up things on the phone, then move them over to your pc before you start this process, because EVERYTHING
on your phone will be wiped
then flash a rom again, from this clean of a state it should fix pretty much anything.
HTC One M8
Stock at the moment
Nexus 7 (2013)