Fix #149

This should fix #149 (and it includes a test to show the fix).