Backport fixes from 2.0.x maintance releases

According to https://github.com/msysgit/msysgit/issues/116#issuecomment-52160201 this works.