BUG: Add bug fixes of masking and wmql pipelines