fix drawing code