Fix bottom and top mask creation in base.