use proper len function