Improved cached entity handling