Sensex, Nifty 50 recover from early losses; realty, IT gain