Write more tests, and expand existing ones. I've written quite a lot of custom logic now, all of which should be thoroughly tested.