Fixed removing the last character: if separator is longer, remove whole sep