Entity manager bug