fix another issue with convert to factor