fixed computation fo storage and free memory