Fixed Thread.join() sometimes hanging even if the thread has finished. (#70)