Add check on mask length