Legth

fix typo in js and better checks against null and 0