The other day, I saw a pornographic advertisement on the front page of Reddit. The ad had a naked woman in it, which was striking because Google and Facebook (together accounting for more than 60 percent of online ad spending) usually keep their ubiquitous adverts PG-rated, regardless of how filthy your cookies are. I clicked the ad, for the sake of science, and it led to a website called Ersties — “finest handmade erotica” — which seemed to be oriented toward hipsters, with a cartoon penis and vulva hanging out on the top of the page.

“That sounds very concerning,” said Dipayan Ghosh, a fellow at the New America Foundation and former advisor to Facebook and the Obama White House who studies algorithms and online advertising. “A reasonable person wouldn’t be wrong to think that he shouldn’t see pornographic or other disturbing sorts of advertising on a large social media network like Reddit.”

It’s perfectly possible that Reddit’s ad platform saw something in my history that led it to serve me a not-safe-for-work advertisement. Ad platforms, like those run by Google and Facebook, collect vast stores of information about our browsing habits and use them to julienne us into hyper-specific demographics for maximum influence and profit.

Reddit’s ad platform, however, seems to struggle with basic functions like keeping porn off the front page. Reddit hosts many forums with adult content, but they’re all supposed to be marked as “NSFW” to keep users from accidentally viewing them in inappropriate contexts. Ersties itself has fielded complaints about the errant ads in its account’s public comments since last summer, and even brought them to the attention of Reddit.

Sometimes Ersties trolls its critics. When one concerned used posted, “FUCKING DELETE THIS,” Ersties replied dismissively: “u ok hun?” Other times it blames Reddit, claiming that the site’s ad platform was malfunctioning and showing the porn ads to users on regular parts of the site.

“This ad campaign is only supposed to be appear [sic] in ‘after dark’ subreddits,” it wrote last summer, in response to another complaint. “If it appears anywhere else, then we can only apologize but the issue is at Reddit's end and not ours.”

By December, though, Ersties’ concern had grown. Whoever runs the account posted a plaintive note to the official subreddit of the Reddit Ads Platform, in which it described a broken ad system that showed its racy ads to anyone, regardless of whether they were browsing x-rated parts of the site. It described a journey through a circuit of Reddit support representatives, one of whom provided byzantine directions to visit a web page that wouldn’t load.

“Please could someone help, provide a reachable email, or advise in any capacity,” the account wrote. “Thanks.”

“I informed Reddit as soon as the comments started coming in,” said a representative of Ersties. “In general I find their ad support pretty awful, for a company this size especially, and true to form they weren't great in correcting this issue.”

A Reddit spokesperson who declined to be identified by name said that the company has been making improvements to its ad platform, and that the changes introduced a bug that let the ad display in a non-adult subreddit. Reddit fixed the problem after Ersties complained on the Reddit Ads Platform subreddit in December, the representative said, and Ersties was refunded for ad buys affected by the glitch. The ad I saw, the representative said, was due to a separate error that has also now been fixed.

“As we’ve made improvements to our ad stack and product, we’ve encountered a few bugs,” the company said in a statement. “In this particular instance, a bug temporarily broke our adult whitelisting logic — which we resolved as soon as we became aware of it. We’ll be putting in additional product safeguards to prevent bugs like this from affecting our targeting capabilities in the future.”

At first blush, it’s surprising that such a glitch would make it onto Reddit’s ad platform. Reddit is the seventh most visited site on the web, according to a ranking by web analytics firm Alexa, and it’s attracted investors including the prestigious Andreessen Horowitz as it’s swelled to a value of nearly $2 billion. That’s a huge chunk of internet real estate, which you’d expect to be an advertising cash machine.

In reality, Reddit has long struggled to monetize its platform. Its user base is outspoken and hates being pandered to, and has publicly shredded figures ranging from Mike Cernovich to Wyclef Jean when they tried to make promotional appearances on the site’s “ask me anything” forum.

“It’s not that Redditors hate brands,” said a Reddit’s director of communications Victoria Taylor, in 2014, the year before she was fired by Reddit co-founder Alexis Ohanian, in a move that resulted in what the New York Times called a “user uprising” which led to the ouster of interim chief executive Ellen Pao. “It’s that they hate feeling manipulated by brands.”

Other ads I see on Reddit don’t inspire confidence that the platform is on its way to getting it together. Some offer scammy-looking investment advice, like “7 Breakout Stocks Likely to Jump” and “Buy Bitcoin with your IRA.” Others included a dating site I’d never heard of, Zoosk, and a higher education lead generation site called EducationConnection.

It’s hard for any advertiser to say no to cash, but it’s surprising to Ghosh that Reddit isn’t trying harder to meet the bare minimum of keeping porn ads on smutty parts of the site. From a business point of view, the worst case scenario for any online publisher is that a new user will see something icky, become offended, and not come back — and even a site like Reddit, with its entrenched culture of free speech, has a responsibility to protect its users from salacious content.

“Reddit is a special place,” Ghosh said. “It’s different from any other platform in the sense that it is absolutely part of the movement to give people a say and a place to come and be who they are and say whatever is on their mind. And I think that culture toward free speech pervades into its advertising mechanisms and policies as well.”