better close 'image'
a bit of input validation