Added autocorrecture of gain