fix margin reports bugs (wrong group by + jquery syntax error)