you can prevent this by boilng the wood for at least 20 mins then leaving in soak overnight, then soak in hot water for the next 24hrs.
To cure your tank of tannins after not doing the above, or even if you have a stubbons piece that refuses to be leeched. the only way is 20% water changes every day untill its cleared.
The only thing tannin does is raises the ph a bit and of course dis-colours the water so you can't see the fish.
HTH