Fix bugs in prun script.