added debug to draw procedure