fixed insert bugs