Fix overflows in overlays.