Fix some race conditions in the module bank