FIX Nice errors and allows flush on module removal
Merge pull request #2257 from hafriedlander/fix/flush_30

FIX Nice errors and allows flush on module removal