Small fix and cleanup in TWSUtils.