type checking fails with a correct type