check for nil in ensure part