Fix incorrect logic for Scope#getCommonParent()