Fix logic for type checks.