bug fixes in MainActivity