Finish the last function Apply Space

Finish the last function Apply Space
Fix a thread bug

Fix a thread bug