tried to catch errors in opening files