fixes #1783

fixed the issue, committed the code for review, please check it..