Fixes to safety check len function