simplify getProp() related code and fix lang.exists() corner case, fixes #16291