fixed erros in type factory