The same thing happened to me and it still does sometimes.
He sleeps on my bed at night which is relatively high up so he can't get off. So when he wakes up he definitely has to pee and usually poop too. I found that this was the best time to train them to go to the right place. Right when I wake up I put him in a little pen with just a pee pad. He goes pee right away, then whines abit, and eventually will go poop Now, during the day he will most of the time go to the pee pad to poop. He still has several accidents (mostly under tables too!), but its getting better.
Good luck!