Final fix for #1239