Fixes for #510