Bug fixes found while working on Android bulid.