Fix various configure & build issues

This also fix issue #117