fix some patch form original example alex's library