Fix bugs

Correct errors introduced by using poor tools and "Copy and Paste"