fix crashing when no connection