Some fixes and XML exporting