add some scripts and fix some bugs