fixed inevitable bug when seperating main