Fixing typos and enhancing debugging