fix bugs, works well, but need to change the main for two different type