Fixed bug in z-indices

Wouldn't work with multiple clients.