fixed null checking in main activity