Fix some bugs for Project 4