Add fuction LEN and fix some bugs