fixed gain bug.