fix the bugs in the initial commit