fix cstorage bug, improve mem usage