Fixing issue #325 by undoing issue #220. Also minor fixes for pilot module handling.