bugfix for quality function