adding error callback