construct_path now allocates the exact length