Added debug error print function