Cleanup of removeQuotes method. Fixes #15586