Fix some bugs in puppet-scripts