Fixes  #4780
Merge pull request #4878 from mwerezak/horsemask

Fixes  #4780