index 0 insertion bug fixed