Fix some minor bugs, delete unused file