couple bug fixes and additional changes for gallery/image refactor