Fix floor arithmetic error