Output SVM-format file and fix bug