Added check for empty public ids