Fix modal overlay reference bug. Fixes #471, thanks MaklaCof