Bug fix on remove entity when flush with entity manager