fix lock in TestCharExpand