fixed scoping bug
reverted printf / hprintf type to (IO a) because apparent GHC bug