Fix wrong arguments being passed to a function