Tests for #339