Avoid length of undefined values

Old perls warn on undef passed to length