Persistant Query fix
TODO update
Leak fix