Fix for #522