Problem: writefile() continues after detecting an error. Solution: Bail out as soon as an error is detected. (suggestions by Nikolai Pavlov, closes #1476)
Problem: Marks, writefile and nested function tests are old style. Solution: Turn them into new style tests. (Yegappan Lakshmanan)