Add some sanity/length checks for internal data