Fix bugs in smart casing.