fixed #67, #68 and #69

This commit patches issues #67, #68 and #69