apply logout function