Bug fix when handling entityId dictionary keys