fixed the error because of the static entity manager