Fixed some bugs,