Resolving a bug where the app would crash when sliding to the last screen