Fix potential null pointer exception in DeleteTempate command