Query tweak.
Fixing some bugs when servers have no devices.