add qwi_gain file and fix bugs