unreliable fix for determining gateway basenames, closes #143.