add more type sanity checks