fix the quality means output function
some functional code
script now works