fixed bug with gains