proper error handling in imagegrid