Fix using the wrong variable for output