Fix some bugs.
Add prun script for period run job.