Add more check on principalId