Fix error 500 on logout