Fix invalid by ref call