Issue #131 - fix bugs