fix quitting error and viewer moved to sub thread