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

Fixes issue #69, occurred was due to missed null safety which is tackled now in a similar way as in issue #25