Fix removal of trailing chars