Fixed issue #114 and #135

needs discussion