offset by one error fixed