fix variables around the wrong way