Fixes errors in the Haskell functions