Fixed some bugs and add new method