naive changes to make it compile with ghc 7.8.3