added test case to MainActivity.java and fixed a few errors