prevent undefined offset error