Added check for existence of childScope