fix skipping clear
fixing invalid char
separate line prossors for different cases