Fix typos and exception handling.