fixes to RISC-V trap handling