Fixed the indefinite running issue.