added error function callback