fix for not writing [spaces] sometimes