fix code to insert/update games