fix the bug that make gain be higher and higher