fix incorrect offset check