Fixed some bugs so that t2w.py can actually run