Fix bug preventing removal of trailing whitespace