improve uncurrying function