Fixed issue #722: Pull/Push sometimes does not gets the right remote branch

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>