fixed typo, and added another sanity check