Second set of fixes for Android #284