Fix for #341

This fixes issue #341