bugfixes and adjustments to galleries