modified to use error callback function