added check to Redraw function