improved validation subs to check defined, split tls options and removed items check from cm_query()