added onerror handler to the image loader