Fix bug on strict mask matching