Fix sms undefined id variable issue