Fixes for Android 4.3

Credit to dominos_liberty for much of this. I modified his villec2 commit for the pyramid.