fix codeName check; fix NPE; fix Close() method
fix NPE
disable background thread to detect dead loop
add more log to locate OOM issue