Added some sanity checks.