fixed attachement and image file so that it handles malformed URI's