fix for #509