Fixed var mistake
Better fs writes