variable scope error fixed in room data