fix some bug in screen handling