updated the onError callback