Constructor from value or nil