Make sure your homeownership dreams don’t turn into nightmares — here’s how to protect yourself.