add some sanitization to gallery logic