[entity] fix "Only variable references should be returned by reference"