old error function now receives arguments as parameter to make it work as it worked before