fixed a packing problem and added a test