fixing navigation (handling page changes and disabling buttons when necessary)