Make len() helper safer