Incorporated solution by @adriaanm.
Fix the null problems.