fixed redraw bugs