Fix resource and competence JSON API. Fix editing resources.