fix trailing whitespaces when no input is done