Fixed grouping issues by devices

Some dodgy sorting was screwing up how the issues were being grouped.
This is now fixed.