Better ID usage when using custom_id

Sometimes id could be saved as string, default.
- When integer: Prevent memory allocation error with PHP_INT_MAX check.