only squeeze out unused dimensions if necessary