Fixed a bug where the app would crash on resume