update train and test method