fix connect_callback() so redirect is correct upon failure