Fixed bug on redraw function.