Fixed a bug - r_id was not increasing