Merged patches and fixes from https://github.com/nkoep/libjit