Don't run inserts through query1 anymore, check afterwards if sql generated an id or not + fix slight stupidity in user