Fixed some bugs

Fixed some bugs