added error printing