finish parameter and fix some bugs