Replaced FileUtils.write with more vobose solution due to weird compilation error