mask mode bug fix and performance improvement in hybrid modes