Fixed issue where galleries weren't being organized properly.