logout does not invoke callback properly