added error msg to be printed out