added mask validation