rearrange for repack to work