Fixed Firefox error causing gallery JS to malfunction