Android 4.2 and up (and possibly lower) was broken

The fix is in lines 281 & 409, the other lines are mostly my IDE being pedantic ;)