added UnboundLocalError image exception