fix error being passed to callback