remove all nils in list

also change ti if-not as when-not implies sideeffects