fix behaviour when file can't be opened