[AESH-250]
added a test to verify that masking works as expected
plus fixed another maxing bug