fixed error callback not being triggered