Changed the way the error callback is called.