updating a couple files with more error checking and fixing a unit conversion bug