Add checks to hook.php