Fix JS problems in overlays