added training history saving