Fixed a few bugs in screen switching.