Fixed logout so that it actually works correctly