Fix #986 for galleries
fix conflict
Merge pull request #1000 from getnikola/fix-986-in-galleries

Fix #986 for galleries