added error function back in