check if attribute exists before retrieve it