(1) Don't turn your bike over to clean the chain (or for any other reason). You risk damaging cable housings, cables and your computer; and you'll definitely scuff your saddle, brake hoods and/or handlebar tape. If it's too much bother to lift your rear wheel off the ground (which to me it is, just to clean the chain), then turn the crank backwards. Easy as that. (Did your computer ever work properly? It's possible you bent the contacts by having the bike upside down...)
(2) Along the same lines, I'm guessing that when your bike is resting on top of the handlebar, it's also resting on the computer, putting pressure on it and improving the connection. Try cleaning the contacts with a Scotch-Brite pad (either dry or with brake/contact cleaner, but be careful with the latter because they're pretty toxic); remove any debris with a brush or compressed air; apply a drop of WD-40 to prevent corrosion; and if it still doesn't work, take it back.
If you didn't buy the computer new and can't take it back, then the next step would be if there's a spring in the contacts, GENTLY and CAREFULLY bend it out a little bit with a small screwdriver, the end of a safety pin, or something similar. But don't try that if it's returnable.