added changes for compatibility with ghc 7.8