Some cats simply will not stay inside. My wife and I once "adopted" a stray cat. He was very affectionate, and started approaching us when we were out on the deck. He would come inside, stay the night, but when he wanted to leave, he would leave. We even had him neutered in an attempt to try to keep him inside. He spent a lot of time in the house, and would always come back; though it might be a day or two before we saw him again (he may have had several families he stayed with). We had him around for 5 or 6 years before he never came back one day.
We have an indoor cat now that has always been an indoor cat. But the feral ones sometimes will not allow themselves to become 100% domesticated.