fixed -R to work with files