 extension ModuleHom where X: FreeModuleType, Y: FreeModuleType {
     public static func linearlyExtend(_ f: @escaping (X.Generator) -> Codomain) -> ModuleHom<X, Y> {
         return ModuleHom { (m: Domain) in
-            m.decomposed().sum { (a, r) in r * f(a) }
+            m.isGenerator ? f(m.unwrap()) : m.decomposed().sum { (a, r) in r * f(a) }
         }
     }
     

    associatedtype Generator: FreeModuleGenerator
    static func wrap(_ a: Generator) -> Self
    func unwrap() -> Generator
    static func combine<n>(generators: [Generator], vector: ColVector<n, CoeffRing>) -> Self
    func factorize(by: [Generator]) -> DVector<CoeffRing>
    func factorize(by: [Generator], indexer: (Generator) -> Int?) -> DVector<CoeffRing>

    }
    
    public func unwrap() -> A {
        assert(isGenerator)
        return elements.first!.key
    }
    
    public var isGenerator: Bool {
        return (elements.count == 1) && (elements.first!.value == .identity)
    }

    public static var zero: FreeModule<A, R> {
