Manchester City have survived a scare against third-division Leyton Orient to advance to the fifth round of the FA Cup.