Fix possible crash
Fix typo causing tests to fail