update image rendering and error handling