Fixed bug causing columns to be z-sorted in the wrong direction.

Closes #2941