add support for factors with some missing levels