Fixed a pair of bugs in MainActivity