Fix a bug that would incorrectly cycle between space identifiers

This was causing some flickering under certain rare circumstances because Dock
owned windows would be identified as being on the wrong space.

Closes #166