fixed a bug regarding the drawing of overlays