updated error checking
fix wrong variable name
Merge pull request #284 from teharrison/develop

bug fixes and updates