Solve some minor bugs