Fix for optional packages disregarding excluded packages