Fix bug in handling overlapped bitmaps