Fixed the logic to cover all cases. Fixed the missing return registers (v-regs).