Fix sorting items without score last.
Make script python3 compatible.