Our Maltese did the same thing around age of two, but how we got him to stop pooping inside we offered him his favorite treat if he pooped out side. Once he found he was getting “Good Boy” and a treat” now he does it out side. Very few times now he may have an accident if no ones. But he’s 100% better