Fixes a bug when using Double types as sorting key