delete one of reference
fix bug and change code style