Fix bounding box calculation for spatial queries (closes #718)

Thanks @jasisz for the fix