Fixing issue #159 and #160.