Fix out of bound while resolving