Fixed almost everything from issue #370

Ref https://github.com/zaggino/brackets-git/issues/370