bug fixing, issues: #29, #33