moved code from onCreate to onResume