Fix for nil values that cause a crash