Novak Djokovic had to win two tie-breaks against Alex Michelsen to progress to the third round in Shanghai.