modify callback and error handling