Fix deadlock in Tornado threads (single-threaded now)

See #1