tweaked sql for acts