Added null checks where app has crashed.