minor changes, fixed bug where screen flashed