fix some bugs of sun scripts