fixed callback not working in error situations