implement mapMaybeWithKey