update to handle file errors