fix some bug and optimize