Fixed round_to_int to handle negative numbers properly