fix some bugs and autofile updating