Xml creator fixed

Had some stupid mistakes as i reviewed my code to improve it
Fixed the issues