Fix #843 (for real this time): Build system does not always identify modules correctly, refs #910