Nifty 50, Sensex dip as midcaps offset HDFC Bank gains