Simplify and fix a bug in getting the ModuleSum

If `hipspec A/B.hs` is run, but B.hs defines the  module B rather than A.B,
it will still work.