Fix for #509