public void saveFile(String filename) {
		try {
			List<String> sections_list = new ArrayList<String>();
			for (String key : map.keySet()) {
				String section = key.split("\\.")[0];
			    if (!sections_list.contains(section)) sections_list.add(section);
			}
			PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8"));
			for (String sect : sections_list) {
				writer.write("[" + sect + "]\n");
				for (String key : map.keySet()) {
					String[] keys = key.split("\\.");
					if (sect.equals(keys[0])) {
						writer.write(keys[1] + "=" + map.get(key) + '\n');
					}
				}
			}
			writer.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println("Error while saving ini file: " + filename);
		}
	}