More null checking to fix #104