fixed #387 : handling null exceptions