B16 bug fixes

Some bug fixes for crashes found in Triage for beta16

http://ankidroid-triage.appspot.com/view_crash?crash_id=5024686702329856
http://ankidroid-triage.appspot.com/view_crash?crash_id=5121233272176640
http://ankidroid-triage.appspot.com/view_crash?crash_id=5310615560126464


@trashcutter, you will be interested in c5226cf