[MRG] Fix for #2835

This should hopefully fix #2835. 

CC: @arjoly