Corrected implementation of modules collector