Fix sum with direction option