fancy additions for PSz
fix for arithmetic exception (div by 0)
fix compare methods to fulfill their general contract
Get rid of warning-related compilation error