Complete fix for #304