Shadows in camera tracked scene I'm having some issues with setting up the compositing on a camera tracked scene.
Here is the scene:


In the background layer i have a wall that my charactor will cast a shadow on,  (circled in red), but as you can see in the above image, the camera then moves behind the wall. 
The problem now occurs:

as you can see, the wall casts a shadow on its self causing an unwanted artifact in the render.
I am using (pretty much) the default "setup tracking scene" node layout


I have tried playing around with the ray visibility, but havnt had any success.

Thanks for answers in advance
This isn't a complete solution, because it doesn't work for the ambient occlusion, but you can get rid of the shadow in compositing.

Create a emission Material, with the Backfacing output of the Geometry node fed into the Color in the Emission node.



Then create a new render layer, that includes the same layers as the Background layer, but replaces the materials with this new one, using the Material option in the render layer panel (you still want no materials on the actual objects, to keep the correct shadow calculations).



In compositing, use a Mix node with an Add blend mode to combine this render layer with your shadow/AO nodes.