fixed error being correctly passed into callback functions