added wellformedness check