new hooks and fix query for multisite