Fix index out of range ex eption and tablet display ssues