definededness check improved