Fixed concurrency problem that might have happened for postgres uid generator