fixed null pointer at disconnect