bug fix: return null when query instancesb but  out of range