Fixed overflow in local_thr results calculation