check for len ==0 instead of nil