minor: doc, plus robustness improvement if() to avoid ClassCastException