adding logout safegaurd