Port commit 51daf53e193fcba961e5e4dce9551173176615df to ibex
Fix minor
Port commits 6c13590a9c4b59aa58a356eb60b84dfb3e643c2e and b52e029c413cbe1d1e15165ea6d37688f634d03e of original ibex.
Port commit 89795c72ceaf294e3e81e30c4c6ab4f02c200c1f from original ibex.