Fix syntax error and logout code