fixing write.table calls