fixed the bug

and made a sample driver