fix bug in hook