Fix hook/unhook commands more and add test cases