Ugly multithread support