Church of Scotland admits institutional homophobia