this didn't work with fix permission for me.
my mothers phone was really f*cked, tried restoring old backups, tried full wipe, of all kinds, "for new ROM" "factory reset" change recovery.
but allways and with new fresh ROM install after full wipe it would FC everything, the device was compleatly useless.
the only thing that worked for me was to format the data partition with TWRP
Samsung Galaxy S4 (GT-I9505) | Nexus 7
Samsung Galaxy S3 LTE (GT-I9305N) - sold
HTC Desire - sold | HTC Incredible S - sold | HTC One X - dead GPU
HTC MTeoR - sold | HTC TyTN - sold