Fix bugs, run detectindent automatically when opening a file