Fix some bugs and add error display in comments.