(very) selective backporting of core engine changes from the enterprise edition