Added some sanity checks