Use isValid instead of checking offset in location