Fixed (hopefully the last) bug on chunk management.