Fixed bug - rename var from mask to mask_type