Fix ArrayOutofBound error in findTargetBlock. Take offset / 512.