fix bug, used wrong variable