sql inserts bug resolved