fixed null pointer on connection