Fixed a bug, thread was using 100% CPU needlessly