Fixes #49 by adding some null-check