Fixed some empty f.write() calls