adding some sanity checks