Fixed rare fs.write errors
Fixed various small errors and reached 100% code coverage