Fix typo on len -> length, also add line break consideration