Fix deriving of Eq and Ord instances