Fixed overlay bug in which overlays disappeared on second load