Issue #21154:fix gain loss account