fixed wrong formula for quality