Fixed reference errors  and xml formatter