Added safety to hook and unhook