android code improvements and bugfixes