Fixes drawing function bugs.