fix insertion bug