fix bug of mongodb connection and ejs rendering