saving image inside a try/catch fixes #11