fix logout function

Earlier logout function was broken. Using the logout route as a fix.