Fix some bugs

I fixed some bugs.
if mistook, please comment.