changed typo, and improved sanity checks