Merged changes, added set initial directory for thread to root.