fix bug and polish