Oops, this was obviously not thread-safe.