Changes to allow compilation under ghc 7.8.2