modifying the predict function for dataframes too