fix draw function