mainActivity != null else will cause crash when stoped a lone time