[#46] Fix for NullPointerException - fixes #46

I was abble to reproduce issue #46 and proposed fix solve my case