Fix some strangeness when Doctrine is using Proxies internally