Fixes for issues #87, #89, #90