fix for non-greedy masks