fix main fun bugs, start to test