fixed erroneous comparison causing offset error