Improvements for #89
Test and fix for #88