Implemented issue #68 and fixed #34