add guards to prevent repeat extension