Broken query if using hooks

Signed-off-by: emanuele <emanuele45@gmail.com>