fix and improve hive_module detection