Fixing bug in building modules with multiple dependencies