minor fixes for spatial key encoding and region search