Avoid inserting actions to db if they exist, minor table setup bugfix