fix gain lost per day code