How to render a background image correctly?
My guess would be that You missed to check the "transparent" checkbox under "film" in the "render" tab. Furthermore, You, perhaps, have switched the inputs in the "alpha over" node. See image to find critical settings marked with red circles.