fixed array_filter issue on new galleries
Do checks before adding an attachment. Fixes #19