Fixed creating new threads on and on

There was a major bug which caused the plugin to spawn new threads on and on until no threads were available anymore.