improve naming
fix bug. cache being saved even though object larger than allocated memory