Fixed issues of entity manager factory