Added error callback handling