In no case may a custodial sentence be imposed that exceeds the sentence prescribed for the underlying offense. If the underlying offense is punishable by a different type of penalty, the custodial sentence shall be replaced by a fine of six to twenty-four months, unless the underlying offense carries a penalty equal to or less than this, in which case the offender shall be sentenced to half the penalty for the underlying offense.