fixes #2011

Fixed the issue, pushed the code for review, please check it.