Fixed Issue #69 by adding null safe check similar to the one in issue #25

The issue was due to missed null safety which is tackled now in a similar way as in issue #25