fix drawing rectangles