Fixes in accepting and handling connection.