minor bugfix in flexible_mask