Fix race condition on Mask show/hide operations