Tests for #509