fix some bug and add some controls