Added some basic sanity checks that were suppose to be there. No idea why I waited this long to put these checks into place