Tudou fix #3643 and quality sorting

Hi,
this fixes #3643. Also, qualities where compared by string value, so in case of qualities `['101', '9']`, `'9'` would be selected as the higher quality. f931e25 fixes that.