Fix minor issue with id incrementing logic