Fix some bugs with character classes