Fix several crashes in dalvik. Thanks nightmare!