Checking for instance of a nil value and returning 0