fix casting issue with mongoose, end session on logout