Fixed an indexing bug in pack & calibrate