Fix support of aliases combined with reference locked packages, fixes #1631