fix typos and protect against empty value