fix bugs and remove useless const