Fixed some bugs and spelling mistakes