fix leaks on namespaces for some local methods