now I think everything is working: from training to sampling