lint: remove unused references, fix global leak