fix bugs in ex4