Adding error handling

Forgot to add error handling two files. Done it now.