add test
fix dom insertion bug