add try catch to imageload code