fix unchunk function