implemented issue #213. fixed issue #216