Fix difficulty calculation