added isNil() function