Standard residue names have three letters. In case of the CHARMM dialect, also four letters are allowed. This has been neglected when writing the terminal residue.