fix handling with NULL and ignore ""