fix generation of keys when using fields from class cache