fixing mis-ordered variable