Fix for #11036, updated with comments of @Stof