fix truncation due to integer division (found by Michael Niedermayer)