Finally fixed write.table issue