Fix some derps in the code that make it breaking when used.
Fix some derps in the code that make it breaking when used.

Also removed some old unused code from the backport.

julianxhokaxhiu/CyanogenModOTA,vegetalte-dev/CyanogenModOTA,c8813q-dev/CyanogenModOTA,syphyr/CyanogenModOTA