Fix typos and bugs in the correct implementation.