Fix bugs in macThread