remove factor() wrappers and check that df is a data frame.