Fix wrong filename for image file - thanks to @mauglee
Fix bad return for failed attachment
Add test for failing attachment