fixed bug when connect is called without context