Fix reward calculation