fixing draw function