Fixed bug in sorting which discards the keys for instruments filtering