you need to compare your data and structures and work out why its failing - its called debugging