Fixes issue #3740 for horizontal layouts
Merge pull request #3789 from mikehaertl/master

Fixes issue #3740 for horizontal layouts