add a pref command, some help in the config file.
Fix some thread-related bugs.