Fix the bad naming and some bugs.