Solved digital gain problem