added error function
error function