Better error handling for ImageOutputLayer