Added check for data.frame