Apply a hack to avoid array index overflow