Fix range key error in where clause

This will fix the same problem in #146, #148 and #153 with spec.