Fix a bug in wellformed judgment