Added protection against multiple callback invocation on error path