add 'distance.to_f' instead of just .distance before rounding, maybe a postgres issue on heroku.