canonicalize: fix NullPointerException