Fix reduce functions.