Fix #1914 by filtering out null values

Fixes #1914