tmpl = @templates[index]
raise "Botmodule #{botmodule.name} tried to unmap #{tmpl.inspect} that was handled by #{tmpl.botmodule}" unless tmpl.botmodule == botmodule.name
debug "Unmapping #{tmpl.inspect}"
- @templates[handle] = nil
+ @templates[index] = nil
@templates.clear unless @templates.compact.size > 0
end