Fixes for LUB in haskell code