Correcting some bugs and verify compatibility with Android