Ported to OCaml 4.00.1 + opt compilation

2 of 7 tests fail so far...