fixing bug in hooks