Fixes issue #279

Also added an integration level test that confirms the fix.