Fix various environment-dependent compilation errors (#40)