fixes DoesNotExist error when creating a gallery