fixed insertion bug