Bug fix to quality detection