Coerce nil to integer to ensure proper comparison