Fix problems pointed out by Frank
Fix ASAN crash in oracle format