Fixed overlay bug

Overlay opened on keyboard input even if the lightbox wasn't open.
Also changed some minor coding errors.