Fix parameter ordering issue causing incorrect output