Fixed warning Ambiguous call resolved as CORE::length
Improved memory usage