Fix postgres transaction aborted and duplicatin of slugs