Fixed logout bug and minor changes