fix bug. add two functions