exception occuring fix

Fix connected to wrong implementation of compareTo methods