fix db inserts and updating new instanceID