AGH, writing to files isn't working so well