Fixes #268
Fixes sorting problem