Fix compilation errors and hlint suggestions.