Map's closure needs to return an optional

When there is an error, it might be impossible to make a value, so we
need to return an optional.