integrated error callback
added debug callback