fix index error when getting alpha channel mask