Fix argument order and other bugs caught by the oracle