This may solve the multithreading problem