Fixes issue 3076

As the title says, this fixes #3076.