fix up the naive implementation