Solved bugs in screen refresh