API and sql update script fix