Support modules in compilation, fix guard compilation