Fix bugs

Bugs have been fixed.