Encode longer strings correctly, improve fragmentation test