Fix for loading doc with entities