Fix bugs in exercise1.