#827 Improve null handling