trim input to avoid massive deletion