Fix global leak
Fix build