Fixing the last id issue