fix insert bugs when values contains nulls