fixed connect middleware