Fixed removal of prefixes and suffixes