fix bug and add new func