made query friendly for undefined value