Home sales exclusion for a senior in a nursing home

After purchasing her home in 1995, my mom moved into a nursing home in 8/2013 due to her requirement for 24-hour assistance. Her home sat empty until she sold it on 6/1/2018. Therefore, she only partially met the residency requirement - two out of the 24 months. This seems to go against the spirit of the law, but perhaps there is no accommodation. I would like to hear your thoughts. Thank you.