Fix difficulty calculation bug.