insert model + fix bugs