object in front of alpha tex

I’ve read several topics about this but couldn’t find anything helpful. Here’s a small peace of my rendered image:
Everything’s fine with my alpha textures for trees but the problem appears when we have some objects in front of alpha texture. Like above, some roof and branches. The mentioned objects have annoying edges taking their color from the sky texture behind.
Tried many solutions but none of them seems to work.
Any ideas?

Switch on ZTransp under material tab.

wow it works. Don’t understand why but it solves the problem.