memory fixes for when screen toggles fullscreen, and some other polishing