Complete test; fix bug in logout