handle case of empty array of keys