add proper handling of empty set nils