more bug fixing on masks