Added more sanity checks