bug index out of bounds in list