fix errors in bug #135 and fix bug #66
Merge pull request #139 from bkanuka/bug-#135

fix errors in bug #135 and fix bug #66