Fix some bugs and spelling mistakes