removed global error function