fixed gallery issue

fixed gallery info being added to database more than once