bug fixes to canvas drawing