Improved null handling.