Possibly fix pending connection (fix #244)

Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>