Fixed bugs on Algorithm Thread and Cyclic Algorithm