fix for issue #31
fix for issue #32
Merge bug fixes from branch 'master' into new-ui