Fixing hash issue in zigzag queries