as.data.frame call makes things more robust