add more sanity checking