fix revisions sql