Fix for #1045