problem 2: fix code bug