bugfix and improve dir2xml