Fixed minor xml issue
Fixed way of fetching next ID