Fix some bugs and indentations