Fixed bug & replaced deprecated connect middleware