Bugfixing the variable flipping qualitiy functions.