Added support for error callbacks