Relations 637

This would fix #637. All the valid relations are tested, and we also check that invalid ones can not be created.