fix bugs for task 3