Bug fixes

Fixed illegal state exception during onPause