fixed recursion calls to be compatible with the qthread functions;