Added printErr() funtion for error printing