Fix for #312