Fix bug with generated ids