Apply alain91's patches for Issues 68, 71, 77