Fixes to allow compatibility with Android 1.5