Fixed a bug with the viewImage function that would lead to an unhandled
exception.