added pause to fix thread bug