亡羊补牢 (wáng yáng bǔ láo) is a famous idiom meaning 'to mend the sheepfold after losing a sheep' — it's never too late to fix a problem. Here 牢 means 'pen/enclosure.'
memory
The character has 宀 (roof) over 牛 (cow) — a cow under a roof is in a pen. Extended to mean prison (a pen for people).