solve some syntax error and ifstream bug