Fixed a couple non null issues

Fixed a couple non null issues and check to make sure not to overwrite a
file