fix coverity # 22583, 22584, 25074, 24075, possibly null geom pointer, remove, factor...