add more checks for consistent inputs