Bugfixes for the gallery controller