Code and Patch

fixed bug.