prevent double callback when error is thrown