Solution 2: correct errors