bug fixes

Hi
I have made fixes.

Please review.