Fix typo and improve resilience of code if assertions are disabled