Use Function1 instead of WithApply. Thanks for feedback @mkubala.