Fixed invalid empty json result in train function