try to handle the case of computing chunk ids only once correctly.
if i get the logic right, storage needs to be set up at the very beginning
regardless of other flags. not sure the first change is needed, but
definitely the second one, as that would otherwise lead to a NULL pointer
that is causing the segfaults reported.