implements #509