Added XML permissions and debug