avoid list index problems