Fixed wrong ordering of agenda items after order change

Fixed #875