some crude null checks to avoid crashing related to issue #12