Fixed re-draw function