Fix train algorithm and Prunning